<?php
include_once '../samepart/header.php';
?>
<title>No.2商城-商品列表页</title>

<div class="panel panel-default" style="margin: 0 auto;width: 95%;">
    <div class="panel-heading">
        <h3 class="panel-title"><span class="glyphicon glyphicon-th-list"></span>&nbsp;&nbsp;商品列表</h3>
    </div>
    <div class="panel-body">
        <!--列表开始-->
        <div id="cc" class="row text-center" style="margin: 0 auto; height: 100%;">

        </div>
    </div>
</div>
<!-- 底部 -->
<?php include_once '../samepart/footer.php' ?>

<script type="text/javascript">
    //console.log("actionGoodTypeName=" + '<?php //echo $_GET['actionGoodTypeName']?>//')
    $(function () {
        $.ajax({
            url: "http://localhost:80/phalapi/public/index.php?s=App.Goods.getGoodInfoByTypeName",
            type: "get",
            data: {
                "good_type": '<?php echo $_GET['actionGoodTypeName']?>'
            },
            dataType: "JSON",
            success: function (re) {
                var goods_data = re.data.info;
                var s = "";
                var priture_url = "../assets/fmwimages/";
                for (var i = 0; i < goods_data.length; i++) {
                    var goods_id = goods_data[i]['id'];
                    var good_name = goods_data[i]['name'];
                    var good_prcture = goods_data[i]['picture'];
                    var good_intro = goods_data[i]['intro'];
                    var good_price = goods_data[i]['price'];
                    var jsprice_url = priture_url + good_prcture
                    s += "<div class='col-xs-6 col-sm-3 '>" +
                        "<a class='siximg img-responsive' href='" +
                        "goodsDetail.php?actionId=" + goods_id +
                        "'><img src='" +
                        jsprice_url +
                        "' width='234px' height='234px' class='' />" +
                        "</a> " +
                        "<a class='h4' href='" +
                        "goodsDetail.php?actionId=" + goods_id +
                        "'>" + good_name +
                        "</a>" +
                        "<p class='h6'>" + good_intro + "</p>" +
                        "<p class='pri'>￥" + good_price + "元</p>" +
                        "</div>";
                }
                $("#cc").html(s);
            },
            error: function (msg) {
                alert("错误信息：" + msg);
            }
        })
    })
</script>